package loads

import (
	"gvm/instructions/base"
	"gvm/rtda"
)

type DLOAD struct {
	base.Index8Instruction
}

func (self *DLOAD) Execute(jFrame *rtda.JFrame) {
	_dload(jFrame, self.Index)
}

func _dload(frame *rtda.JFrame, index uint) {
	d := frame.LocalVars().GetDouble(index)
	frame.OperandStack().PushDouble(d)
}

type DLOAD_0 struct {
	base.NoOperandsInstruction
}

func (self *DLOAD_0) Execute(jFrame *rtda.JFrame) {
	_fload(jFrame, 0)
}

type DLOAD_1 struct {
	base.NoOperandsInstruction
}

func (self *DLOAD_1) Execute(jFrame *rtda.JFrame) {
	_fload(jFrame, 1)
}

type DLOAD_2 struct {
	base.NoOperandsInstruction
}

func (self *DLOAD_2) Execute(jFrame *rtda.JFrame) {
	_fload(jFrame, 2)
}

type DLOAD_3 struct {
	base.NoOperandsInstruction
}

func (self *DLOAD_3) Execute(jFrame *rtda.JFrame) {
	_fload(jFrame, 3)
}
